package unit5;

public class ParseInt {
    public static void main(String[] args) {
        try {
            String str = "123a";
            int num = Integer.parseInt(str);
            System.out.println("转换成功，数字是：" + num);
        } catch (NumberFormatException e) {
            System.out.println("捕获到异常：输入的字符串无法转换为整数。");
            System.out.println("异常信息：" + e.getClass() + ":" + e.getMessage());
            e.printStackTrace();
        }
    }
}
